home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / perlrun.z / perlrun
Text File  |  1998-10-30  |  32KB  |  793 lines

  1.  
  2.  
  3.  
  4. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      perlrun - how to execute the Perl interpreter
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      ppppeeeerrrrllll [ ----ssssTTTTuuuuUUUU ]      [ ----hhhhvvvv ] [ ----VVVV[:_c_o_n_f_i_g_v_a_r] ]
  13.           [ ----ccccwwww ] [ ----dddd[:_d_e_b_u_g_g_e_r] ] [ ----DDDD[_n_u_m_b_e_r/_l_i_s_t] ]
  14.           [ ----ppppnnnnaaaa ] [ ----FFFF_p_a_t_t_e_r_n ] [ ----llll[_o_c_t_a_l] ] [ ----0000[_o_c_t_a_l] ]
  15.           [ ----IIII_d_i_r ] [ ----mmmm[----]_m_o_d_u_l_e ] [ ----MMMM[----]'_m_o_d_u_l_e...' ]      [ ----PPPP ]
  16.           [ ----SSSS ]      [ ----xxxx[_d_i_r] ]      [ ----iiii[_e_x_t_e_n_s_i_o_n] ]
  17.           [ ----eeee '_c_o_m_m_a_n_d' ] [ -------- ] [ _p_r_o_g_r_a_m_f_i_l_e ] [ _a_r_g_u_m_e_n_t ]...
  18.  
  19. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  20.      Upon startup, Perl looks for your script in one of the following places:
  21.  
  22.      1.  Specified line by line via ----eeee switches on the command line.
  23.  
  24.      2.  Contained in the file specified by the first filename on the command
  25.          line.  (Note that systems supporting the #! notation invoke
  26.          interpreters this way.)
  27.  
  28.      3.  Passed in implicitly via standard input.  This works only if there
  29.          are no filename arguments--to pass arguments to a STDIN script you
  30.          must explicitly specify a "-" for the script name.
  31.  
  32.      With methods 2 and 3, Perl starts parsing the input file from the
  33.      beginning, unless you've specified a ----xxxx switch, in which case it scans
  34.      for the first line starting with #! and containing the word "perl", and
  35.      starts there instead.  This is useful for running a script embedded in a
  36.      larger message.  (In this case you would indicate the end of the script
  37.      using the __END__ token.)
  38.  
  39.      The #! line is always examined for switches as the line is being parsed.
  40.      Thus, if you're on a machine that allows only one argument with the #!
  41.      line, or worse, doesn't even recognize the #! line, you still can get
  42.      consistent switch behavior regardless of how Perl was invoked, even if ----xxxx
  43.      was used to find the beginning of the script.
  44.  
  45.      Because many operating systems silently chop off kernel interpretation of
  46.      the #! line after 32 characters, some switches may be passed in on the
  47.      command line, and some may not; you could even get a "-" without its
  48.      letter, if you're not careful.  You probably want to make sure that all
  49.      your switches fall either before or after that 32 character boundary.
  50.      Most switches don't actually care if they're processed redundantly, but
  51.      getting a - instead of a complete switch could cause Perl to try to
  52.      execute standard input instead of your script.  And a partial ----IIII switch
  53.      could also cause odd results.
  54.  
  55.      Some switches do care if they are processed twice, for instance
  56.      combinations of ----llll and ----0000.  Either put all the switches after the 32
  57.      character boundary (if applicable), or replace the use of ----0000_d_i_g_i_t_s by
  58.      BEGIN{ $/ = "\0digits"; }.
  59.  
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  71.  
  72.  
  73.  
  74.      Parsing of the #! switches starts wherever "perl" is mentioned in the
  75.      line.  The sequences "-*" and "- " are specifically ignored so that you
  76.      could, if you were so inclined, say
  77.  
  78.          #!/bin/sh -- # -*- perl -*- -p
  79.          eval 'exec /usr/bin/perl $0 -S ${1+"$@"}'
  80.              if $running_under_some_shell;
  81.  
  82.      to let Perl see the ----pppp switch.
  83.  
  84.      If the #! line does not contain the word "perl", the program named after
  85.      the #! is executed instead of the Perl interpreter.  This is slightly
  86.      bizarre, but it helps people on machines that don't do #!, because they
  87.      can tell a program that their SHELL is /usr/bin/perl, and Perl will then
  88.      dispatch the program to the correct interpreter for them.
  89.  
  90.      After locating your script, Perl compiles the entire script to an
  91.      internal form.  If there are any compilation errors, execution of the
  92.      script is not attempted.  (This is unlike the typical shell script, which
  93.      might run part-way through before finding a syntax error.)
  94.  
  95.      If the script is syntactically correct, it is executed.  If the script
  96.      runs off the end without hitting an _e_x_i_t() or _d_i_e() operator, an implicit
  97.      exit(0) is provided to indicate successful completion.
  98.  
  99.      ####!!!! aaaannnndddd qqqquuuuoooottttiiiinnnngggg oooonnnn nnnnoooonnnn----UUUUnnnniiiixxxx ssssyyyysssstttteeeemmmmssss
  100.  
  101.      Unix's #! technique can be simulated on other systems:
  102.  
  103.      OS/2
  104.          Put
  105.  
  106.              extproc perl -S -your_switches
  107.  
  108.          as the first line in *.cmd file (-S due to a bug in cmd.exe's
  109.          `extproc' handling).
  110.  
  111.      MS-DOS
  112.          Create a batch file to run your script, and codify it in
  113.          ALTERNATIVE_SHEBANG (see the _d_o_s_i_s_h._h file in the source distribution
  114.          for more information).
  115.  
  116.      Win95/NT
  117.          The Win95/NT installation, when using the Activeware port of Perl,
  118.          will modify the Registry to associate the .pl extension with the perl
  119.          interpreter.  If you install another port of Perl, including the one
  120.          in the Win32 directory of the Perl distribution, then you'll have to
  121.          modify the Registry yourself.
  122.  
  123.      Macintosh
  124.          Macintosh perl scripts will have the appropriate Creator and Type, so
  125.          that double-clicking them will invoke the perl application.
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  137.  
  138.  
  139.  
  140.      Command-interpreters on non-Unix systems have rather different ideas on
  141.      quoting than Unix shells.  You'll need to learn the special characters in
  142.      your command-interpreter (*, \ and " are common) and how to protect
  143.      whitespace and these characters to run one-liners (see -e below).
  144.  
  145.      On some systems, you may have to change single-quotes to double ones,
  146.      which you must _N_O_T do on Unix or Plan9 systems.  You might also have to
  147.      change a single % to a %%.
  148.  
  149.      For example:
  150.  
  151.          # Unix
  152.          perl -e 'print "Hello world\n"'
  153.  
  154.          # MS-DOS, etc.
  155.          perl -e "print \"Hello world\n\""
  156.  
  157.          # Macintosh
  158.          print "Hello world\n"
  159.           (then Run "Myscript" or Shift-Command-R)
  160.  
  161.          # VMS
  162.          perl -e "print ""Hello world\n"""
  163.  
  164.      The problem is that none of this is reliable: it depends on the command
  165.      and it is entirely possible neither works.  If 4DOS was the command
  166.      shell, this would probably work better:
  167.  
  168.          perl -e "print <Ctrl-x>"Hello world\n<Ctrl-x>""
  169.  
  170.      CMD.EXE in Windows NT slipped a lot of standard Unix functionality in
  171.      when nobody was looking, but just try to find documentation for its
  172.      quoting rules.
  173.  
  174.      Under the Macintosh, it depends which environment you are using.  The
  175.      MacPerl shell, or MPW, is much like Unix shells in its support for
  176.      several quoting variants, except that it makes free use of the
  177.      Macintosh's non-ASCII characters as control characters.
  178.  
  179.      There is no general solution to all of this.  It's just a mess.
  180.  
  181.      SSSSwwwwiiiittttcccchhhheeeessss
  182.  
  183.      A single-character switch may be combined with the following switch, if
  184.      any.
  185.  
  186.          #!/usr/bin/perl -spi.bak    # same as -s -p -i.bak
  187.  
  188.      Switches include:
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  203.  
  204.  
  205.  
  206.      ----0000[_d_i_g_i_t_s]
  207.           specifies the input record separator ($/) as an octal number.  If
  208.           there are no digits, the null character is the separator.  Other
  209.           switches may precede or follow the digits.  For example, if you have
  210.           a version of ffffiiiinnnndddd which can print filenames terminated by the null
  211.           character, you can say this:
  212.  
  213.               find . -name '*.bak' -print0 | perl -n0e unlink
  214.  
  215.           The special value 00 will cause Perl to slurp files in paragraph
  216.           mode.  The value 0777 will cause Perl to slurp files whole because
  217.           there is no legal character with that value.
  218.  
  219.      ----aaaa   turns on autosplit mode when used with a ----nnnn or ----pppp.  An implicit
  220.           split command to the @F array is done as the first thing inside the
  221.           implicit while loop produced by the ----nnnn or ----pppp.
  222.  
  223.               perl -ane 'print pop(@F), "\n";'
  224.  
  225.           is equivalent to
  226.  
  227.               while (<>) {
  228.                   @F = split(' ');
  229.                   print pop(@F), "\n";
  230.               }
  231.  
  232.           An alternate delimiter may be specified using ----FFFF.
  233.  
  234.      ----cccc   causes Perl to check the syntax of the script and then exit without
  235.           executing it.  Actually, it _w_i_l_l execute BEGIN, END, and use blocks,
  236.           because these are considered as occurring outside the execution of
  237.           your program.
  238.  
  239.      ----dddd   runs the script under the Perl debugger.  See the _p_e_r_l_d_e_b_u_g manpage.
  240.  
  241.      ----dddd::::_f_o_o
  242.           runs the script under the control of a debugging or tracing module
  243.           installed as Devel::foo. E.g., ----dddd::::DDDDPPPPrrrrooooffff executes the script using
  244.           the Devel::DProf profiler.  See the _p_e_r_l_d_e_b_u_g manpage.
  245.  
  246.      ----DDDD_l_e_t_t_e_r_s
  247.  
  248.      ----DDDD_n_u_m_b_e_r
  249.           sets debugging flags.  To watch how it executes your script, use
  250.           ----DDDDttttllllssss.  (This works only if debugging is compiled into your Perl.)
  251.           Another nice value is ----DDDDxxxx, which lists your compiled syntax tree.
  252.           And ----DDDDrrrr displays compiled regular expressions. As an alternative,
  253.           specify a number instead of list of letters (e.g., ----DDDD11114444 is
  254.           equivalent to ----DDDDttttllllssss):
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  269.  
  270.  
  271.  
  272.                   1  p  Tokenizing and parsing
  273.                   2  s  Stack snapshots
  274.                   4  l  Context (loop) stack processing
  275.                   8  t  Trace execution
  276.                  16  o  Method and overloading resolution
  277.                  32  c  String/numeric conversions
  278.                  64  P  Print preprocessor command for -P
  279.                 128  m  Memory allocation
  280.                 256  f  Format processing
  281.                 512  r  Regular expression parsing and execution
  282.                1024  x  Syntax tree dump
  283.                2048  u  Tainting checks
  284.                4096  L  Memory leaks (not supported anymore)
  285.                8192  H  Hash dump -- usurps values()
  286.               16384  X  Scratchpad allocation
  287.               32768  D  Cleaning up
  288.  
  289.  
  290.      ----eeee _c_o_m_m_a_n_d_l_i_n_e
  291.           may be used to enter one line of script.  If ----eeee is given, Perl will
  292.           not look for a script filename in the argument list.  Multiple ----eeee
  293.           commands may be given to build up a multi-line script.  Make sure to
  294.           use semicolons where you would in a normal program.
  295.  
  296.      ----FFFF_p_a_t_t_e_r_n
  297.           specifies the pattern to split on if ----aaaa is also in effect.  The
  298.           pattern may be surrounded by //, "", or '', otherwise it will be put
  299.           in single quotes.
  300.  
  301.      ----hhhh   prints a summary of the options.
  302.  
  303.      ----iiii[_e_x_t_e_n_s_i_o_n]
  304.           specifies that files processed by the <> construct are to be edited
  305.           in-place.  It does this by renaming the input file, opening the
  306.           output file by the original name, and selecting that output file as
  307.           the default for _p_r_i_n_t() statements.  The extension, if supplied, is
  308.           added to the name of the old file to make a backup copy.  If no
  309.           extension is supplied, no backup is made.  From the shell, saying
  310.  
  311.               $ perl -p -i.bak -e "s/foo/bar/; ... "
  312.  
  313.           is the same as using the script:
  314.  
  315.               #!/usr/bin/perl -pi.bak
  316.               s/foo/bar/;
  317.  
  318.           which is equivalent to
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  335.  
  336.  
  337.  
  338.               #!/usr/bin/perl
  339.               while (<>) {
  340.                   if ($ARGV ne $oldargv) {
  341.                       rename($ARGV, $ARGV . '.bak');
  342.                       open(ARGVOUT, ">$ARGV");
  343.                       select(ARGVOUT);
  344.                       $oldargv = $ARGV;
  345.                   }
  346.                   s/foo/bar/;
  347.               }
  348.               continue {
  349.                   print;  # this prints to original filename
  350.               }
  351.               select(STDOUT);
  352.  
  353.           except that the ----iiii form doesn't need to compare $ARGV to $oldargv to
  354.           know when the filename has changed.  It does, however, use ARGVOUT
  355.           for the selected filehandle.  Note that STDOUT is restored as the
  356.           default output filehandle after the loop.
  357.  
  358.           You can use eof without parenthesis to locate the end of each input
  359.           file, in case you want to append to each file, or reset line
  360.           numbering (see example in the eof entry in the _p_e_r_l_f_u_n_c manpage).
  361.  
  362.      ----IIII_d_i_r_e_c_t_o_r_y
  363.           Directories specified by ----IIII are prepended to the search path for
  364.           modules (@INC), and also tells the C preprocessor where to search
  365.           for include files.  The C preprocessor is invoked with ----PPPP; by
  366.           default it searches /usr/include and /usr/lib/perl.
  367.  
  368.      ----llll[_o_c_t_n_u_m]
  369.           enables automatic line-ending processing.  It has two effects:
  370.           first, it automatically chomps "$/" (the input record separator)
  371.           when used with ----nnnn or ----pppp, and second, it assigns "$\" (the output
  372.           record separator) to have the value of _o_c_t_n_u_m so that any print
  373.           statements will have that separator added back on.  If _o_c_t_n_u_m is
  374.           omitted, sets "$\" to the current value of "$/".  For instance, to
  375.           trim lines to 80 columns:
  376.  
  377.               perl -lpe 'substr($_, 80) = ""'
  378.  
  379.           Note that the assignment $\ = $/ is done when the switch is
  380.           processed, so the input record separator can be different than the
  381.           output record separator if the ----llll switch is followed by a ----0000 switch:
  382.  
  383.               gnufind / -print0 | perl -ln0e 'print "found $_" if -p'
  384.  
  385.           This sets $\ to newline and then sets $/ to the null character.
  386.  
  387.      ----mmmm[----]_m_o_d_u_l_e
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  401.  
  402.  
  403.  
  404.      ----MMMM[----]_m_o_d_u_l_e
  405.  
  406.      ----MMMM[----]'_m_o_d_u_l_e ...'
  407.  
  408.      ----[[[[mmmmMMMM]]]][----]_m_o_d_u_l_e=_a_r_g[,_a_r_g]...
  409.           -m_m_o_d_u_l_e executes use _m_o_d_u_l_e (); before executing your script.
  410.  
  411.           -M_m_o_d_u_l_e executes use _m_o_d_u_l_e ; before executing your script.  You
  412.           can use quotes to add extra code after the module name, e.g.,
  413.           -M'module qw(foo bar)'.
  414.  
  415.           If the first character after the -M or -m is a dash (-) then the
  416.           'use' is replaced with 'no'.
  417.  
  418.           A little builtin syntactic sugar means you can also say
  419.           -mmodule=foo,bar or -Mmodule=foo,bar as a shortcut for -M'module
  420.           qw(foo bar)'.  This avoids the need to use quotes when importing
  421.           symbols.  The actual code generated by -Mmodule=foo,bar is use
  422.           module split(/,/,q{foo,bar}).  Note that the = form removes the
  423.           distinction between -m and -M.
  424.  
  425.      ----nnnn   causes Perl to assume the following loop around your script, which
  426.           makes it iterate over filename arguments somewhat like sssseeeedddd ----nnnn or
  427.           aaaawwwwkkkk:
  428.  
  429.               while (<>) {
  430.                   ...             # your script goes here
  431.               }
  432.  
  433.           Note that the lines are not printed by default.  See ----pppp to have
  434.           lines printed.  If a file named by an argument cannot be opened for
  435.           some reason, Perl warns you about it, and moves on to the next file.
  436.  
  437.           Here is an efficient way to delete all files older than a week:
  438.  
  439.               find . -mtime +7 -print | perl -nle 'unlink;'
  440.  
  441.           This is faster than using the -exec switch of ffffiiiinnnndddd because you don't
  442.           have to start a process on every filename found.
  443.  
  444.           BEGIN and END blocks may be used to capture control before or after
  445.           the implicit loop, just as in aaaawwwwkkkk.
  446.  
  447.      ----pppp   causes Perl to assume the following loop around your script, which
  448.           makes it iterate over filename arguments somewhat like sssseeeedddd:
  449.  
  450.               while (<>) {
  451.                   ...             # your script goes here
  452.               } continue {
  453.                   print or die "-p destination: $!\n";
  454.               }
  455.  
  456.  
  457.  
  458.  
  459.                                                                         PPPPaaaaggggeeee 7777
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  467.  
  468.  
  469.  
  470.           If a file named by an argument cannot be opened for some reason,
  471.           Perl warns you about it, and moves on to the next file.  Note that
  472.           the lines are printed automatically.  An error occuring during
  473.           printing is treated as fatal.  To suppress printing use the ----nnnn
  474.           switch.  A ----pppp overrides a ----nnnn switch.
  475.  
  476.           BEGIN and END blocks may be used to capture control before or after
  477.           the implicit loop, just as in awk.
  478.  
  479.      ----PPPP   causes your script to be run through the C preprocessor before
  480.           compilation by Perl.  (Because both comments and cpp directives
  481.           begin with the # character, you should avoid starting comments with
  482.           any words recognized by the C preprocessor such as "if", "else", or
  483.           "define".)
  484.  
  485.      ----ssss   enables some rudimentary switch parsing for switches on the command
  486.           line after the script name but before any filename arguments (or
  487.           before a --------).  Any switch found there is removed from @ARGV and sets
  488.           the corresponding variable in the Perl script.  The following script
  489.           prints "true" if and only if the script is invoked with a ----xxxxyyyyzzzz
  490.           switch.
  491.  
  492.               #!/usr/bin/perl -s
  493.               if ($xyz) { print "true\n"; }
  494.  
  495.  
  496.      ----SSSS   makes Perl use the PATH environment variable to search for the
  497.           script (unless the name of the script contains directory
  498.           separators).  On some platforms, this also makes Perl append
  499.           suffixes to the filename while searching for it.  For example, on
  500.           Win32 platforms, the ".bat" and ".cmd" suffixes are appended if a
  501.           lookup for the original name fails, and if the name does not already
  502.           end in one of those suffixes.  If your Perl was compiled with
  503.           DEBUGGING turned on, using the -Dp switch to Perl shows how the
  504.           search progresses.
  505.  
  506.           If the file supplied contains directory separators (i.e. it is an
  507.           absolute or relative pathname), and if the file is not found,
  508.           platforms that append file extensions will do so and try to look for
  509.           the file with those extensions added, one by one.
  510.  
  511.           On DOS-like platforms, if the script does not contain directory
  512.           separators, it will first be searched for in the current directory
  513.           before being searched for on the PATH.  On Unix platforms, the
  514.           script will be searched for strictly on the PATH.
  515.  
  516.           Typically this is used to emulate #! startup on platforms that don't
  517.           support #!.  This example works on many platforms that have a shell
  518.           compatible with Bourne shell:
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.                                                                         PPPPaaaaggggeeee 8888
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  533.  
  534.  
  535.  
  536.               #!/usr/bin/perl
  537.               eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
  538.                       if $running_under_some_shell;
  539.  
  540.           The system ignores the first line and feeds the script to /bin/sh,
  541.           which proceeds to try to execute the Perl script as a shell script.
  542.           The shell executes the second line as a normal shell command, and
  543.           thus starts up the Perl interpreter.  On some systems $0 doesn't
  544.           always contain the full pathname, so the ----SSSS tells Perl to search for
  545.           the script if necessary.  After Perl locates the script, it parses
  546.           the lines and ignores them because the variable
  547.           $running_under_some_shell is never true.  A better construct than $*
  548.           would be ${1+"$@"}, which handles embedded spaces and such in the
  549.           filenames, but doesn't work if the script is being interpreted by
  550.           csh.  To start up sh rather than csh, some systems may have to
  551.           replace the #! line with a line containing just a colon, which will
  552.           be politely ignored by Perl.  Other systems can't control that, and
  553.           need a totally devious construct that will work under any of csh,
  554.           sh, or Perl, such as the following:
  555.  
  556.                   eval '(exit $?0)' && eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
  557.                   & eval 'exec /usr/bin/perl -S $0 $argv:q'
  558.                           if $running_under_some_shell;
  559.  
  560.  
  561.      ----TTTT   forces "taint" checks to be turned on so you can test them.
  562.           Ordinarily these checks are done only when running setuid or setgid.
  563.           It's a good idea to turn them on explicitly for programs run on
  564.           another's behalf, such as CGI programs.  See the _p_e_r_l_s_e_c manpage.
  565.  
  566.      ----uuuu   causes Perl to dump core after compiling your script.  You can then
  567.           take this core dump and turn it into an executable file by using the
  568.           uuuunnnndddduuuummmmpppp program (not supplied).  This speeds startup at the expense
  569.           of some disk space (which you can minimize by stripping the
  570.           executable).  (Still, a "hello world" executable comes out to about
  571.           200K on my machine.)  If you want to execute a portion of your
  572.           script before dumping, use the _d_u_m_p() operator instead.  Note:
  573.           availability of uuuunnnndddduuuummmmpppp is platform specific and may not be available
  574.           for a specific port of Perl.
  575.  
  576.      ----UUUU   allows Perl to do unsafe operations.  Currently the only "unsafe"
  577.           operations are the unlinking of directories while running as
  578.           superuser, and running setuid programs with fatal taint checks
  579.           turned into warnings. Note that the ----wwww switch (or the $^W variable)
  580.           must be used along with this option to actually ggggeeeennnneeeerrrraaaatttteeee the taint-
  581.           check warnings.
  582.  
  583.      ----vvvv   prints the version and patchlevel of your Perl executable.
  584.  
  585.      ----VVVV   prints summary of the major perl configuration values and the
  586.           current value of @INC.
  587.  
  588.  
  589.  
  590.  
  591.                                                                         PPPPaaaaggggeeee 9999
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  599.  
  600.  
  601.  
  602.      ----VVVV::::_n_a_m_e
  603.           Prints to STDOUT the value of the named configuration variable.
  604.  
  605.      ----wwww   prints warnings about variable names that are mentioned only once,
  606.           and scalar variables that are used before being set.  Also warns
  607.           about redefined subroutines, and references to undefined filehandles
  608.           or filehandles opened read-only that you are attempting to write on.
  609.           Also warns you if you use values as a number that doesn't look like
  610.           numbers, using an array as though it were a scalar, if your
  611.           subroutines recurse more than 100 deep, and innumerable other
  612.           things.
  613.  
  614.           You can disable specific warnings using __WARN__ hooks, as described
  615.           in the _p_e_r_l_v_a_r manpage and the warn entry in the _p_e_r_l_f_u_n_c manpage.
  616.           See also the _p_e_r_l_d_i_a_g manpage and the _p_e_r_l_t_r_a_p manpage.
  617.  
  618.      ----xxxx _d_i_r_e_c_t_o_r_y
  619.           tells Perl that the script is embedded in a message.  Leading
  620.           garbage will be discarded until the first line that starts with #!
  621.           and contains the string "perl".  Any meaningful switches on that
  622.           line will be applied.  If a directory name is specified, Perl will
  623.           switch to that directory before running the script.  The ----xxxx switch
  624.           controls only the disposal of leading garbage.  The script must be
  625.           terminated with __END__ if there is trailing garbage to be ignored
  626.           (the script can process any or all of the trailing garbage via the
  627.           DATA filehandle if desired).
  628.  
  629. EEEENNNNVVVVIIIIRRRROOOONNNNMMMMEEEENNNNTTTT
  630.      HOME        Used if chdir has no argument.
  631.  
  632.      LOGDIR      Used if chdir has no argument and HOME is not set.
  633.  
  634.      PATH        Used in executing subprocesses, and in finding the script if
  635.                  ----SSSS is used.
  636.  
  637.      PERL5LIB    A colon-separated list of directories in which to look for
  638.                  Perl library files before looking in the standard library and
  639.                  the current directory.  If PERL5LIB is not defined, PERLLIB
  640.                  is used.  When running taint checks (because the script was
  641.                  running setuid or setgid, or the ----TTTT switch was used), neither
  642.                  variable is used.  The script should instead say
  643.  
  644.                      use lib "/my/directory";
  645.  
  646.  
  647.      PERL5OPT    Command-line options (switches).  Switches in this variable
  648.                  are taken as if they were on every Perl command line.  Only
  649.                  the ----[[[[DDDDIIIIMMMMUUUUddddmmmmwwww]]]] switches are allowed.  When running taint
  650.                  checks (because the script was running setuid or setgid, or
  651.                  the ----TTTT switch was used), this variable is ignored.
  652.  
  653.  
  654.  
  655.  
  656.  
  657.                                                                        PPPPaaaaggggeeee 11110000
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  665.  
  666.  
  667.  
  668.      PERLLIB     A colon-separated list of directories in which to look for
  669.                  Perl library files before looking in the standard library and
  670.                  the current directory.  If PERL5LIB is defined, PERLLIB is
  671.                  not used.
  672.  
  673.      PERL5DB     The command used to load the debugger code.  The default is:
  674.  
  675.                          BEGIN { require 'perl5db.pl' }
  676.  
  677.  
  678.      PERL5SHELL (specific to WIN32 port)
  679.                  May be set to an alternative shell that perl must use
  680.                  internally for executing "backtick" commands or _s_y_s_t_e_m().
  681.                  Perl doesn't use COMSPEC for this purpose because COMSPEC has
  682.                  a high degree of variability among users, leading to
  683.                  portability concerns.  Besides, perl can use a shell that may
  684.                  not be fit for interactive use, and setting COMSPEC to such a
  685.                  shell may interfere with the proper functioning of other
  686.                  programs (which usually look in COMSPEC to find a shell fit
  687.                  for interactive use).
  688.  
  689.      PERL_DEBUG_MSTATS
  690.                  Relevant only if your perl executable was built with
  691.                  ----DDDDDDDDEEEEBBBBUUUUGGGGGGGGIIIINNNNGGGG____MMMMSSSSTTTTAAAATTTTSSSS, if set, this causes memory statistics to
  692.                  be dumped after execution.  If set to an integer greater than
  693.                  one, also causes memory statistics to be dumped after
  694.                  compilation.
  695.  
  696.      PERL_DESTRUCT_LEVEL
  697.                  Relevant only if your perl executable was built with
  698.                  ----DDDDDDDDEEEEBBBBUUUUGGGGGGGGIIIINNNNGGGG, this controls the behavior of global destruction
  699.                  of objects and other references.
  700.  
  701.      Perl also has environment variables that control how Perl handles data
  702.      specific to particular natural languages.  See the _p_e_r_l_l_o_c_a_l_e manpage.
  703.  
  704.      Apart from these, Perl uses no other environment variables, except to
  705.      make them available to the script being executed, and to child processes.
  706.      However, scripts running setuid would do well to execute the following
  707.      lines before doing anything else, just to keep people honest:
  708.  
  709.          $ENV{PATH} = '/bin:/usr/bin';    # or whatever you need
  710.          $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
  711.          delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.                                                                        PPPPaaaaggggeeee 11111111
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))                                                          PPPPEEEERRRRLLLLRRRRUUUUNNNN((((1111))))
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.                                                                        PPPPaaaaggggeeee 11112222
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.